<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.*,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="sun.reflect.generics.tree.IntSignature"%>
<%@page import="com.ejoysoft.common.Format"%>
<%@ page import="java.util.List"%>
<%@ page import="org.openflashchart.Graph"%>
<%@ page import="org.openflashchart.Bar"%>
<%@page import="java.util.Random"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ include file="../include/jsp/head.jsp"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>

<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'regional_coverage.jsp' starting page</title>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="../css/main.css" rel="stylesheet" type="text/css" />
	<script language="JavaScript" src="../include/date/popc.js"></script>
	<script src="../include/js/list.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
  <%
	String indexs = ParamUtil.getString(request,"indexs");
  	String str[] = indexs.split(",");
 	String  strCity = globa.enviromentCity;
    //查询条件
	//System.out.println("---------------strCity:"+strCity);
    String  strHotPotName = globa.enviromentHotPotName;
    String  strStartTime = globa.enviromentStartTime.equals("")?"1000-01-01":globa.enviromentStartTime;
    String  strEndTime = globa.enviromentEndTime.equals("")?"9999-12-31":globa.enviromentEndTime;
	
  	int n=str.length;
  	Environment Environment0 = null;
	Environment obj = new Environment(globa);
	//获取所有地市
	String where = " where 1=1 ";
	if(!"".equals(strCity)){
		where += " and strCity = '" + strCity +"' ";
	}
	if(!"".equals(strHotPotName)){
		where += " and strHotPotName like '%" + strHotPotName+ "%' ";	
	}
	
	//ArrayList<String> listcity = obj.returnCity(where);
	ArrayList<String>listHostSpot = obj.listTwoAcs(where);
	Bar b = new Bar("50", "#9933CC");
	//Bar b2 = new Bar("50", "#2843BB");
	Bar b3 = new Bar("50", "#1000AA");
	Bar b4= new Bar("50", "#6540CC");
	//Bar b5 = new Bar("50", "#0937483");
	//Bar b6 = new Bar("50", "#000564");
	Bar b7 = new Bar("50", "#999999");
	//Bar b8 = new Bar("50", "#5433CC");
	Bar b9 = new Bar("50", "#4644df");
	Bar b10 = new Bar("50", "#445544");
	//Bar b11= new Bar("50", "#9754KK");
	
	
	
	b.key("HTTP请求成功率", 15);
	//b2.key("PING成功率", 15);
	b3.key("FTP上行成功率", 15);
	b4.key("FTP下行成功率", 15);	
	//b5.key("WEB认证时延", 15);
	//b6.key("WEB下线时延", 15);	
	b7.key("HTTP响应时延", 15);
	//b8.key("PING平均时延", 15);
	b9.key("FTP上行速率", 15);
	b10.key("FTP下行速率", 15);
	//b11.key("信号强度", 15);
	
	List<String> links = new ArrayList<String>();
	
	for(int k = 0;  k<listHostSpot.size(); k++) {
		String where1 = "where a.strNetType= 'TD' and a.DTCREATDATE  between to_date('" + strStartTime + "','yyyy-MM-dd hh24.mi.ss') and to_date('" + strEndTime + "','yyyy-MM-dd hh24.mi.ss')" ; 
		Vector<Environment> vctObj = obj.returnindex(where1,strCity, listHostSpot.get(k));
		double sun1=0,sun2=0,sun3=0,sun4=0,sun5=0,sun6=0,sun7=0,sun8=0,sun9=0,sun10=0,sun11=0,sun12=0,sun13=0,sun14=0,sun15=0,sun16=0,sun17=0,sun18=0,sun19=0;
		int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
		if(vctObj!=null){
    	for (int j = 0;j < vctObj.size(); j++) {
	    	Environment obj1 = vctObj.get(j);
	    	for (int i=0;i<=n-1;i++)
	    	{
  		     
		    if(str[i].contains("intHttp_Req_Sucrate"))
		    {
		     sun1+=obj1.getIntHttp_Req_Sucrate();
		    }
		    if(str[i].contains("intPing_Sucrate"))
		    {
		     sun2+=obj1.getIntPing_Sucrate();
		    }
		    if(str[i].contains("intFtp_Up_Sucrate"))
		    {
		     sun3+=obj1.getIntFtp_Up_Sucrate();
		    }
		    
		   if(str[i].contains("intFtp_Down_Sucrate"))
		   {
		     sun4+=obj1.getIntFtp_Down_Sucrate();
		    }
		   
		   if(str[i].contains("intWeb_Up_Delay"))
		   {
		     sun5+=obj1.getIntWeb_Up_Delay();
		    }
		   if(str[i].contains("intWeb_Down_Delay"))
		    {
		     sun6+=obj1.getIntWeb_Down_Delay();
		    }
		   
		   if(str[i].contains("intHttp_Resp_Delay"))
		   {
		     sun7+=obj1.getIntHttp_Resp_Delay();
		    }
		   if(str[i].contains("intPing_Delay"))
		   {
		     sun8+=obj1.getIntPing_Delay();
		    }
		   if(str[i].contains("intFtp_Up_Speed"))
		   {
		     sun9+=obj1.getIntFtp_Up_Speed();
		    }
		   if(str[i].contains("intFtp_Down_Speed"))
		   {
		     sun10+=obj1.getIntFtp_Down_Speed();
		    }
		    if(str[i].contains("intRssi"))
		   {
		     sun11+=obj1.getIntRssi();
		    }
	    }
	    }
	    }
	    
	    
	    for(int i=0;i<n;i++){
		    
		    if(str[i].contains("intHttp_Req_Sucrate"))
		    {
		     	sun1=sun1/intVct;
			    b.add(Double.toString(sun1),"");
		    }
		    if(str[i].contains("intPing_Sucrate"))
		    {
		    	sun2=sun2/intVct;
			    //b2.add(Double.toString(sun2),"");
		    }
		    if(str[i].contains("intFtp_Up_Sucrate"))
		    {
		     	sun3=sun3/intVct;
			    //b3.add(Double.toString(sun3),"");
		    }
		    
		   if(str[i].contains("intFtp_Down_Sucrate"))
		   {
		     	sun4=sun4/intVct;
			    b4.add(Double.toString(sun4),"");
		    }
		   
		   if(str[i].contains("intWeb_Up_Delay"))
		   {
		     	sun5=sun5/intVct;
			    //b5.add(Double.toString(sun5),"");
		    }
		   if(str[i].contains("intWeb_Down_Delay"))
		    {
		     	sun6=sun6/intVct;
			    //b6.add(Double.toString(sun6),"");
		    }
		   
		   if(str[i].contains("intHttp_Resp_Delay"))
		   {
		     	sun7=sun7/intVct;
			    b7.add(Double.toString(sun7),"");
		    }
		   if(str[i].contains("intPing_Delay"))
		   {
		     	sun8=sun8/intVct;
			    //b8.add(Double.toString(sun8),"");
		    }
		   if(str[i].contains("intFtp_Up_Speed"))
		   {
		     	sun9=sun9/intVct;
			    b9.add(Double.toString(sun9),"");
		    }
		   if(str[i].contains("intFtp_Down_Speed"))
		   {
		     	sun10=sun10/intVct;
			    b10.add(Double.toString(sun10),"");
			}
			 if(str[i].contains("intRssi"))
		   {
		     	sun11=sun11/intVct;
			   // b11.add(Double.toString(sun11),"");
			}
			   
	    }
	    }
		
		
		
	
  
	Graph g = new Graph();
	//坐标标题
	g.title("多指标对比", "{font-size: 25px;}");
	g.getData_sets().add(b);
	//g.getData_sets().add(b2);
	g.getData_sets().add(b3);
	g.getData_sets().add(b4);
	//g.getData_sets().add(b5);
	//g.getData_sets().add(b6);
	g.getData_sets().add(b7);
	//g.getData_sets().add(b8);
	g.getData_sets().add(b9);
	g.getData_sets().add(b10);
	//g.getData_sets().add(b11);
	
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	g.bar("0");
	//g.bar("0");
	//g.bar("0");
	//g.bar("0");
	//g.bar("0");
	//g.bar("0");
	
	List<String> labels = new ArrayList<String>();
	for(int i=0;i<listHostSpot.size();i++){
	
		labels.add(listHostSpot.get(i));
	}
	g.set_x_labels(labels);
	g.set_x_label_style("12", "#006699", 0, 1, "");
	g.set_x_axis_steps(1);
	g.set_x_tick_size(5);
	g.set_bg_colour("#eaf7fc");

	g.set_y_right_label_style("12", "#006699");	
	g.attach_to_y_right_axis(labels);//添加y右坐标轴
	g.set_y_right_max(10);
	g.set_y_right_min(0);
	g.set_y_max(10);
	g.set_y_min(0);
	//g.set_y_right_max(50);
	//g.set_y_right_min(-50);
	g.y_label_steps(10);
	//g.set_tool_tip("#val#<br>");
%>
<%=g.render()%>
  </body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>
